﻿<UserControl x:Class="Waf.Writer.Presentation.Views.RichTextView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:p="clr-namespace:Waf.Writer.Presentation.Properties"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:Waf.Writer.Applications.ViewModels;assembly=Waf.Writer.Applications"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:RichTextViewModel}"
    d:DesignWidth="300" d:DesignHeight="200">
    
    <ScrollViewer>
        <RichTextBox x:Name="richTextBox" TextChanged="RichTextBoxTextChanged" SelectionChanged="RichTextBoxSelectionChanged" 
                     IsVisibleChanged="RichTextBoxIsVisibleChanged"
                     ContextMenuOpening="RichTextBoxContextMenuOpening" ContextMenuClosing="RichTextBoxContextMenuClosing"
                     SpellCheck.IsEnabled="{Binding IsSpellCheckEnabled}" AcceptsTab="True" BorderThickness="0">
            <RichTextBox.LayoutTransform>
                <ScaleTransform ScaleX="{Binding Zoom}" ScaleY="{Binding Zoom}"/>
            </RichTextBox.LayoutTransform>
            
            <RichTextBox.ContextMenu>
                <ContextMenu x:Name="contextMenu">
                    <MenuItem Command="ApplicationCommands.Cut" Header="{x:Static p:Resources.CutMenu}" Icon="{StaticResource CutImage}"/>
                    <MenuItem Command="ApplicationCommands.Copy" Header="{x:Static p:Resources.CopyMenu}" Icon="{StaticResource CopyImage}"/>
                    <MenuItem Command="ApplicationCommands.Paste" Header="{x:Static p:Resources.PasteMenu}" Icon="{StaticResource PasteImage}"/>
                    <Separator/>
                    <MenuItem Command="EditingCommands.ToggleNumbering" Header="{x:Static p:Resources.NumberedList}" IsChecked="{Binding IsNumberedList}"/>
                    <MenuItem Command="EditingCommands.ToggleBullets" Header="{x:Static p:Resources.BulletedList}" IsChecked="{Binding IsBulletList}"/>
                </ContextMenu>
            </RichTextBox.ContextMenu>
        </RichTextBox>
    </ScrollViewer>
    
</UserControl>
